<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"> </script>
</head>
<body>
  <div id="app">
    {{ time | formatTime('-',123)  }}
    {{ time | formatTime('.',123)  }}
  </div>

  <script>

    new Vue({
      el: "#app", 
      data: {     
        name: "韩梅梅",
        time: (new Date()).getTime()
      },
      filters: {
        formatTime: (data,tag,num) => {
          console.log(data, tag, num)
          const y = (new Date(data)).getFullYear();
          const m =  (new Date(data)).getMonth() + 1;
          const d =  (new Date(data)).getDate();
          return `${y}${tag}${m}${tag}${d}`
        }
      }
    })
  </script>
</body>
</html>